/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	/**
	 * Created by Administrator on 2017/3/14.
	 */
	var Layer = __webpack_require__(2);
	var dropdown1 = [
	    {
	        option: "下拉1",
	        value: "1"
	    },
	    {
	        option: "下拉2",
	        value: "2"
	    },
	    {
	        option: "下拉3",
	        value: "3"
	    },
	    {
	        option: "下拉4",
	        value: "4"
	    },
	    {
	        option: "下拉5",
	        value: "5"
	    }
	];
	var Root = React.createClass({displayName: "Root",
	    _handleClick: function (e) {
	        //打开多个窗口可以用这方法(取当前标签属性data-layer的值，减少对每个弹窗添加click)
	        this.refs[e.target.getAttribute("data-layer")].layerOpen();
	    },
	    _handleConfirm: function (e) {
	        this.refs.layer4.layerClose(); //关闭当前的
	        this.refs[e.target.getAttribute("data-layer")].layerOpen();　//打开新的
	    },
	    _confirmBack: function () {
	        alert("您点击了确定");
	        //this.refs.layer7.layerClose();
	    },
	    _cancelBack: function () {
	        alert("您点击了取消,取消后会关闭窗口，因为有关闭回调，因此还会弹出关闭提示");
	        this.refs.layer7.layerClose();
	    },
	    _closeBack: function () {
	        alert("您点击了关闭，有回调时这时不能关闭窗口");
	        //this.refs.layer7.layerClose();
	    },
	    render: function () {
	        return (
	            React.createElement("div", null, 
	                React.createElement("p", null, React.createElement("a", {href: "javascript:;", onclick: this._handleClick.bind(this), "data-layer": "layer1"}, "打开基本弹窗")), 
	                React.createElement("p", null, React.createElement("a", {href: "javascript:;", onclick: this._handleClick.bind(this), "data-layer": "layer2"}, "打开弹窗2(成功提示)")), 
	                React.createElement("p", null, React.createElement("a", {href: "javascript:;", onclick: this._handleClick.bind(this), "data-layer": "layer3"}, "打开弹窗3(失败提示)")), 
	                React.createElement("p", null, React.createElement("a", {href: "javascript:;", onclick: this._handleClick.bind(this), "data-layer": "layer4"}, "表单窗口")), 
	                React.createElement("p", null, React.createElement("a", {href: "javascript:;", onclick: this._handleClick.bind(this), "data-layer": "layer5"}, "多内容时出现滚动条，适合协议类")), 
	                React.createElement("p", null, React.createElement("a", {href: "javascript:;", onclick: this._handleClick.bind(this), "data-layer": "layer6"}, "自动关闭")), 
	                React.createElement("p", null, React.createElement("a", {href: "javascript:;", onclick: this._handleClick.bind(this), "data-layer": "layer7"}, "回调")), 
	                React.createElement("p", null, React.createElement("a", {href: "javascript:;", onclick: this._handleClick.bind(this), "data-layer": "layer8"}, "不显示遮罩")), 

	                React.createElement("h3", null, "更多参数可查看layer.js"), 

	                React.createElement(Layer, {ref: "layer1", title: "标题"}, 
	                    "最基本弹窗"
	                ), 
	                React.createElement(Layer, {ref: "layer2", title: "提交成功", type: "success", confirm: "确认"}, 
	                    "恭喜，提交成功，点击确认关闭窗口"
	                ), 
	                React.createElement(Layer, {ref: "layer3", title: "提交失败", type: "failure", confirm: "确认", width: "500"}, 
	                    React.createElement("p", null, "抱歉抱歉，提交失败，点击确认关闭窗口"), 
	                    React.createElement("p", null, "失败原因：失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因失败原因")
	                ), 
	                React.createElement(Layer, {ref: "layer4", title: "绑定银行卡", width: "600"}, 
	                    React.createElement("div", {className: "ucs-form-group"}, 
	                        React.createElement("label", {className: "label"}, "用户名："), 
	                        React.createElement("div", {className: "ucs-input-control"}, 
	                            React.createElement("input", {type: "text", className: "ucs-input", placeholder: "请输入用户名"})
	                        )
	                    ), 
	                    React.createElement("div", {className: "ucs-form-group"}, 
	                        React.createElement("label", {className: "label"}, "密码："), 
	                        React.createElement("div", {className: "ucs-input-control"}, 
	                            React.createElement("input", {type: "password", className: "ucs-input", placeholder: "请输入用户名"})
	                        )
	                    ), 
	                    React.createElement("div", {className: "ucs-form-group"}, 
	                        React.createElement("label", {className: "label"}, "下拉")
	                    ), 
	                    React.createElement("div", {className: "ucs-layer-footer"}, 
	                        React.createElement("button", {className: "ucs-btn ucs-btn-confirm", onClick: this._handleConfirm.bind(this), "data-layer": "layer2"}, 
	                            "确认"
	                        )
	                    )
	                ), 
	                React.createElement(Layer, {ref: "layer5", title: "注册协议", width: "500", height: "400"}, 
	                    React.createElement("p", null, "注册协议"), 
	                    React.createElement("p", {style: "height:600px;"}, "这里是详细内容"), 
	                    React.createElement("p", null, "注册协议")
	                ), 
	                React.createElement(Layer, {ref: "layer6", title: "自动关闭", autoClose: "30"}, 
	                    React.createElement("br", null), React.createElement("br", null), React.createElement("br", null), "自动关闭自动关闭"
	                ), 
	                React.createElement(Layer, {ref: "layer7", title: "回调", type: "text", confirm: "确定", cancel: "取消", width: "500", 
	                       confirmBack: this._confirmBack.bind(this), cancelBack: this._cancelBack.bind(this), closeBack: this._closeBack.bind(this)}, 
	                    "点击确定、取消、关闭时回调"
	                ), 
	                React.createElement(Layer, {ref: "layer8", title: "不显示遮罩", maskLayer: false}, 
	                    "不显示遮罩"
	                )

	            )
	        );
	    }
	});
	ReactDOM.render(React.createElement(Root, null), document.getElementById('main'));

/***/ },
/* 1 */,
/* 2 */
/***/ function(module, exports, __webpack_require__) {

	/**
	 * Created by Administrator on 2017/3/14.
	 */
	var Button = __webpack_require__(3);
	//查询样式是否存在
	function hasClass(elem, cls) {
	    elem = elem || {};
	    return new RegExp("\\b" + cls + "\\b").test(elem.className);
	}
	//添加样式
	function addClass(elem, cls) {
	    elem = elem || {};
	    hasClass(elem, cls) || (elem.className += " " + cls);
	    elem.className = elem.className.replace(/^\s|\s$/g, "").replace(/\s+/g, " ");
	}
	//删除样式
	function removeClass(elem, cls) {
	    elem = elem || {};
	    if (hasClass(elem, cls)) {
	        elem.className = elem.className.replace(new RegExp("(\\s|^)" + cls + "(\\s|$)"), "");
	    }
	};
	//obj为要绑定事件的元素，ev为要绑定的事件，fn为绑定事件的函数
	function myAddEvent(obj, ev, fn) {
	    if (obj.attachEvent) {
	        obj.attachEvent("on" + ev, fn);
	    }
	    else {
	        obj.addEventListener(ev, fn, false);
	    }
	}
	function myRemoveEvent(obj, ev, fn) {
	    if (obj.attachEvent) {
	        obj.detachEvent("on" + ev, fn);
	    }
	    else {
	        obj.removeEventListener(ev, fn, false);
	    }
	}

	var Layer = React.createClass({displayName: "Layer",
	    getDefaultProps: function () {
	        return {
	            display: false,
	            type: "",
	            width: "",
	            height: "",
	            className: "",
	            showClose: true,
	            closeBack: "",
	            position: "fixed",
	            confirm: "",
	            confirmBack: "",
	            cancel: "",
	            cancelBack: "",
	            afterBack: "",
	            animation: "layer-anim-1",
	            maskLayer: true,
	            shadeClose: false,
	            move: true,
	            autoClose: 0,
	            id: "",
	            left: "",
	            top: "",
	            contentHeight: "" //内容区域高
	        }
	    },
	    componentDidMount: function () {
	        myAddEvent(window, 'resize', this._handleResize.bind(this));
	    },
	    layerOpen: function () {
	        var _this = this;
	        this.refs.ucslayer.style.display = "block";
	        addClass(this.refs.ucslayer,this.props.animation);
	        this._setPosition();
	        //添加遮罩层
	        this.props.maskLayer ? this._maskLayer() : "";
	        //窗口加载完回调
	        this.props.afterBack ? this.props.afterBack() : "";
	        //计算倒计时
	        this.props.autoClose > 0 ? this._handleCountdown() : "";
	    },
	    layerClose: function () {
	        this.refs.ucslayer.style.display = "none";
	        removeClass(this.refs.ucslayer,this.props.animation);
	        //移除遮罩层
	        document.body.removeChild(this.divEL);
	        if (this.props.shadeClose) {
	            myRemoveEvent(this.divEL, 'click', this._handleMaskLayerClick);
	            //this.divEL.removeEventListener('click', this._handleMaskLayerClick);
	        }
	        this.props.closeBack ? this.props.closeBack() : "";
	        clearInterval(this.timer);
	    },
	    _handleResize: function () {
	        //console.log("窗口改变");//传个参数进去，浏览器窗口缩放时不修改弹出层的宽高，只调整位置保持居中
	        //确保窗口在显示状态才执行缩放，隐藏下取不到高
	        this.refs.ucslayer.style.display === "block" ? this._setPosition("resize") : "";
	    },
	    _handleCountdown: function () {
	        //倒计时
	        clearInterval(this.timer);
	        var i = this.props.autoClose;
	        this.timer = setInterval(function () {
	            i--;
	            this.refs.autoClose.innerHTML = i;
	            if (i == 0) {
	                this.layerClose();
	            }
	        }.bind(this), 1000);
	    },
	    _maskLayer: function () {
	        this.divEL = document.createElement('div');
	        this.divEL.className = "layer-background";
	        document.body.appendChild(this.divEL);
	        this.props.shadeClose ?
	            myAddEvent(this.divEL, 'click', this._handleMaskLayerClick) : "";
	        //this.divEL.addEventListener("click", this._handleMaskLayerClick) : "";
	    },
	    _handleMaskLayerClick: function () {
	        //遮罩层点击
	        this.layerClose();
	    },
	    _setPosition: function (t) {
	        //浏览器窗口宽高兼容写法
	        this.windowWidth = (document.documentElement.scrollWidth > document.documentElement.clientWidth) ? document.documentElement.scrollWidth : document.documentElement.scrollWidth;
	        this.windowHeight = (document.documentElement.scrollHeight > document.documentElement.clientHeight) ? document.documentElement.scrollHeight : document.documentElement.clientHeight;

	        //如果设定了高宽，则使用设定的
	        this.layerWidth = this.props.width ? this.props.width : this.refs.ucslayer.offsetWidth;
	        this.layerHeight = this.props.height ? this.props.height : this.refs.ucslayer.offsetHeight;
	        this.layerHeight = this.layerHeight > this.windowHeight ? this.windowHeight : this.layerHeight;//如果弹层高度大于浏览器窗口高，则使用浏览器窗口高
	        var scrollTop = 0;// 滚动条的高度
	        if (this.props.position == "absolute") {
	            if (document.documentElement && document.documentElement.scrollTop) {
	                scrollTop = document.documentElement.scrollTop;
	            }
	            else if (document.body) {
	                scrollTop = document.body.scrollTop;
	            }
	        }
	        var left = (parseInt(this.windowWidth) - parseInt(this.layerWidth)) / 2;
	        var top = (parseInt(document.body.clientHeight) - parseInt(this.layerHeight)) / 2;
	        if (t !== "resize") {
	            this.refs.ucslayer.style.width = this.layerWidth;
	            this.refs.ucslayer.style.height = this.layerHeight;
	        }
	        this.refs.ucslayer.style.left = left + "px";
	        this.refs.ucslayer.style.top = top < 0 ? 0 : top + "px";
	        if(this.refs.layerHeader){
	            this.refs.layerContent.style.height = parseInt(this.layerHeight) - parseInt(this.refs.layerHeader.offsetHeight);
	        }else{
	            this.refs.layerContent.style.height = parseInt(this.layerHeight);
	        }

	    },
	    _handleCloseClick: function () {
	        //点击关闭时
	        this.props.closeBack ? this.props.closeBack() : this.layerClose();
	    },
	    _handleConfirmClick: function () {
	        //确认按钮点击时
	        this.props.confirmBack ? this.props.confirmBack() : this.layerClose();
	    },
	    _handleCancelClick: function () {
	        //取消按钮点击时
	        this.props.cancelBack ? this.props.cancelBack() : this.layerClose();
	    },
	    _handleMousedown: function (e) {
	        if (this.props.move) {
	            this.mx = e.pageX - parseInt(this.refs.ucslayer.style.left);
	            this.my = e.pageY - parseInt(this.refs.ucslayer.style.top);
	            this.move = true;
	            myAddEvent(document, 'mousemove', this._handleMouseMove.bind(this));
	            myAddEvent(document, 'mouseup', this._handleMouseUp.bind(this));
	        }
	    },
	    _handleMouseMove: function (e) {
	        if (this.move) {
	            e = event || window.event;
	            var x = e.clientX - parseInt(this.mx);
	            var y = e.clientY - parseInt(this.my);

	            var documentHeight = document.documentElement.clientHeight;
	            if (x <= 0) {
	                x = 0
	            } else if (x > parseInt(this.windowWidth) - parseInt(this.layerWidth)) {
	                //window窗口宽－弹层宽
	                x = parseInt(this.windowWidth) - parseInt(this.layerWidth)
	            }
	            if (y <= 0) {
	                y = 0
	            } else if (y > documentHeight - parseInt(this.layerHeight)) {
	                y = documentHeight - parseInt(this.layerHeight)
	            }
	            this.refs.ucslayer.style.left = x + "px";
	            this.refs.ucslayer.style.top = y + "px";
	            return false;
	        }
	    },
	    _handleMouseUp: function () {
	        this.move = false;
	        myRemoveEvent(document, 'mousemove', this._handleMouseMove.bind(this));
	        myRemoveEvent(document, 'mouseup', this._handleMouseUp.bind(this));

	    },
	    render:function(){
	        var props = this.props;
	        var style = "width:" + props.width + ";" + "height:" + props.height + ";" + "display:"+(props.display ? "block;" : "none;")+ "position:"+ props.position+";";
	        var bodyClass = "ucs-layer-body "+(props.type?"ucs-layer-text":"");
	        var bodyContent = "";
	        if (props.type === "text") {
	            //纯文字
	            bodyContent = (React.createElement("div", {className: "ucs-layer-txt"}, props.children));
	        } else if (props.type === "success") {
	            //成功时
	            bodyContent = (
	                React.createElement("div", {className: "ucs-layer-success"}, 
	                    React.createElement("i", {className: "iconfont icon-success icon"}), 
	                    props.children
	                )
	            )
	        }
	        else if (props.type === "failure") {
	            //失败时
	            bodyContent = (
	                React.createElement("div", {className: "ucs-layer-failure"}, 
	                    React.createElement("i", {className: "iconfont icon-failure icon"}), 
	                    props.children
	                )
	            )
	        } else {
	            //其它
	            bodyContent = props.children
	        }
	        var close = (
	                props.showClose ? React.createElement("a", {href: "javascript:;", className: "ucs-layer-close", onclick: this._handleCloseClick.bind(this)}) : ""
	            )
	            ;
	        var button = "";
	        if (props.confirm || props.cancel) {
	            button = (
	                React.createElement("div", {className: "ucs-layer-footer"}, 
	                    props.confirm ? React.createElement(Button, {onclick: this._handleConfirmClick.bind(this), buttonType: "confirm", value: props.confirm}) : "", 
	                    props.cancel ? React.createElement(Button, {onclick: this._handleCancelClick.bind(this), buttonType: "cancel", value: props.cancel}) : ""
	                )
	            );
	        }
	        var autoClose = (
	            this.props.autoClose > 0 ? React.createElement("div", {className: "ucs-autoclose"}, React.createElement("span", {ref: "autoClose"}, this.props.autoClose), "秒后自动关闭!") : ""
	        );
	        var moveStyle = "cursor:"+(this.props.move ? "move;" : ";");
	        return (
	            React.createElement("div", {className: "ucs-layer "+props.className+" "+props.animation, style: style, ref: "ucslayer", id: this.props.id}, 
	                close, 
	                props.title ? React.createElement("div", {className: "ucs-layer-header", onmousedown: this._handleMousedown.bind(this), ref: "layerHeader", style: moveStyle}, props.title) : "", 
	                autoClose, 
	                React.createElement("div", {className: "ucs-layer-content", ref: "layerContent", style: "height:"+props.contentHeight+";"}, 
	                    React.createElement("div", {className: bodyClass}, bodyContent), 
	                    button
	                )
	            )
	        )
	    }
	});

	module.exports = Layer;

/***/ },
/* 3 */
/***/ function(module, exports) {

	var Button = React.createClass({displayName: "Button",
		config:{
	        id:""
	    },
		render: function() {
			var customClassNameArr=this.props.className?this.props.className.split(' '):'';
	        var customClassName ='ucs-btn';
	        if(customClassNameArr.length>0){
	            for(var i=0;i<customClassNameArr.length;i++){
	                customClassName=customClassNameArr[i]+' '+customClassName;
	            }
	        }
			this.props.className = customClassName;
			var id = this.props.id?this.props.id:'';
			if(this.props.href){
				return React.createElement("a", {id: id, onclick: this.props.onclick, className: this.props.className, href: this.props.href}, this.props.value)
			}else{
				return React.createElement("button", {id: id, onclick: this.props.onclick, className: this.props.className}, this.props.value)
			}
		}
	})
	module.exports = Button;

/***/ }
/******/ ]);